package prototypeDemo.example;

/**
 * @author zsh
 * @Description
 * @create 2022-05-16 19:32
 */
public class UnderlinePen implements Product {
    private char ulChar;

    public UnderlinePen(char ulChar){
        this.ulChar = ulChar;
    }
    @Override
    public void use(String s) {
        int len = s.length();
        System.out.println("\"" + s + "\"");
        for (int i = 0; i < len ; i++) {
            System.out.print(ulChar);
        }
        System.out.println("");

    }

    @Override
    public Product createClone() {
        Product p = null;
        try {
            p = (Product)clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return p;
    }
}
